package com.wc.alorithm_luogu.P1597;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/4/23 20:32
 * @description https://www.luogu.com.cn/problem/P1597
 * 语句解析
 */
public class Main {
    public static void main(String[] args) {
        int[] abc = new int[128];


        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        s = s.replace(" ", "");

        String[] split = s.split(";");

        char letter;
        int num;
        String[] letterAndNum;
        for (int i = 0; i < split.length; i++) {
            letterAndNum = split[i].split(":=");
            letter = letterAndNum[0].charAt(0);
            switch (letterAndNum[1]) {
                case "a": {
                    num = abc['a'];
                    break;
                }
                case "b": {
                    num = abc['b'];
                    break;
                }
                case "c": {
                    num = abc['c'];
                    break;
                }
                default:
                    num = Integer.parseInt(letterAndNum[1]);
            }

            abc[letter] = num;
        }

        System.out.print(abc['a']);
        for (int i = 'b'; i <= 'c'; i++) {
            System.out.print(" " + abc[i]);
        }
    }
}
